import requests
import json


def get_auth_url():
    weibo_auth_url = "https://api.weibo.com/oauth2/authorize"
    redirect_uri = ""
    client_id = ""
    auth_url = f"{weibo_auth_url}?client_id={client_id}&redirect_uri={redirect_uri}"
    print(auth_url)


def get_access_token(code):
    access_token_url = "https://api.weibo.com/oauth2/access_token"
    client_id = ""
    client_secret = ""
    redirect_uri = ""
    res = requests.post(access_token_url, data={
        "client_id": client_id,
        "client_secret": client_secret,
        "grant_type": "authorization_code",
        "code": code,
        "redirect_uri": redirect_uri
    })
    data = json.loads(res.text)
    access_token = data.get("access_token")
    uid = data.get("uid")


def get_user_info(access_token, uid):
    user_info_url = f"https://api.weibo.com/2/users/show.json?access_token={access_token}&uid={uid}"
    client_id = ""
    client_secret = ""
    redirect_uri = ""